package com.itheima.dao.impl;

import com.itheima.dao.BookDao;
import com.itheima.entitiy.Book;
import lombok.Data;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

// 相当于 bean 的 id
@Repository("bookDao")

// 是否 是 单例模式
@Scope("singleton")
public class BookDaoImpl implements BookDao {
    @Override
    public void save() {
        System.out.println("book dao save ...");
    }


    @PostConstruct
    public void init(){
        System.out.println("方法执行前需要执行的操作");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("容器销毁后的方法");
    }
}
